package com.example.studyspringdemo.controller;

import com.example.studyspringdemo.biz.UserBiz;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.IOException;

@Controller
public class SystemController {
    @Resource
    private UserBiz userBiz;

    @GetMapping("login")
    public String login(ModelMap model){
        model.addAttribute("userName","test");
        return "login";
    }
    @GetMapping("login1")
    public void login1(ModelMap model, HttpServletResponse response){
        model.addAttribute("userName","test");
        try {
            response.sendRedirect("/");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
